package com.wlyuan.index.domain.source.adapter;

import com.wlyuan.index.api.dto.order.OrderIndexDTO;
import com.wlyuan.order.vo.OrderDetailVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * 运单事件详情（对应运输服务的 WaybillEventDTO类）
 *
 * @author liuqingqing
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class OrderAdapter extends OrderDetailVO {

    @Mapper
    public interface Translator {
        OrderIndexDTO translate(OrderDetailVO source);
    }

    private static final Translator TRANSLATOR = Mappers.getMapper(Translator.class);

    public static OrderIndexDTO translate(OrderDetailVO source) {
        return TRANSLATOR.translate(source);
    }
}
